#ifndef LOGINWIDGET_H
#define LOGINWIDGET_H

#include <QDialog>
#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QIcon>
#include <QGridLayout>
#include <QPushButton>

#include "verifycodewidget.h"
#include "model/datacenter.h"
#include "toast.h"
#include "mainwidget.h"

class LoginWidget : public QDialog
{
    Q_OBJECT
public:
    LoginWidget(QWidget* parent = nullptr);

private slots:
    void clickSubmitBtn();
    void userLoginDone(bool success, const QString& msg);
    void userRegisterDone(bool success, const QString &msg);
    void switchMode();
private:
    QLabel* m_tipLabel = nullptr;
    QLineEdit* m_usernameEdit = nullptr;
    QLineEdit* m_passwordEdit = nullptr;
    QLineEdit* m_verifyCodeEdit = nullptr;
    VerifyCodeWidget* m_verifyCodeWidget = nullptr;
    QPushButton* m_submitBtn = nullptr;
    QPushButton* m_phoneModeBtn = nullptr;
    QPushButton* m_switchModeBtn = nullptr;

    // 是否是登录模式
    bool m_isLoginMode = true;
};

#endif // LOGINWIDGET_H
